//
// Consts.as - Constants used in a variety of applications.
//
// copyright (c) 2006-2007, Jim Armstrong.  All Rights Reserved.
//
// This software program is supplied 'as is' without any warranty, express, implied, 
// or otherwise, including without limitation all warranties of merchantability or fitness
// for a particular purpose.  Jim Armstrong shall not be liable for any special incidental, or 
// consequential damages, including, without limitation, lost revenues, lost profits, or 
// loss of prospective economic advantage, resulting from the use or misuse of this software 
// program.
//
// Programmed by:  Jim Armstrong, Singularity (www.algorithmist.net)

package singularity.numeric;
 
  class Consts
   {
    
    public var EPSILON(getEPSILON, null) : Float ;
    public static var ZERO_TOL:Float = 0.0001; // zero tolerance
    
    public static var PI_2:Float       = 0.5*Math.PI;
    public static var PI_4:Float       = 0.25*Math.PI;
    public static var PI_8:Float       = 0.125*Math.PI;
    public static var PI_16:Float      = 0.0625*Math.PI; 
    public static var TWO_PI:Float     = 2.0*Math.PI;
    public static var THREE_PI_2:Float = 1.5*Math.PI;
    public static var ONE_THIRD:Float  = 1.0/3.0;
    public static var TWO_THIRDS:Float = ONE_THIRD + ONE_THIRD;
    public static var ONE_SIXTH:Float  = 1.0/6.0;
    public static var DEG_TO_RAD:Float = Math.PI/180;
    public static var RAD_TO_DEG:Float = 180/Math.PI;
    
    public static var CIRCLE_ALPHA:Float = 4*(Math.sqrt(2)-1)/3.0;
    
    public static var ON:Bool  = true;
    public static var OFF:Bool = false;
    
    public static var AUTO:String         = "A";
    public static var DUPLICATE:String    = "D";
    public static var EXPLICIT:String     = "E";
    public static var CHORD_LENGTH:String = "C";
    public static var ARC_LENGTH:String   = "AL";
    public static var UNIFORM:String      = "U";
    public static var FIRST:String        = "F"; 
    public static var LAST:String         = "L";
    public static var POLAR:String        = "P";
    
    // Machine-dependent
    var __epsilon:Float;
    	
    public function new()
    {
      // Machine epsilon ala Eispack
      var __fourThirds:Float = 4.0/3.0;
      var __third:Float      = __fourThirds - 1.0;
      var __one:Float        = __third + __third + __third;
      __epsilon               = Math.abs(1.0 - __one);
    }

    public function getEPSILON():Float { return __epsilon; }
  }
